package com.movitech.mobile.base.config;

import com.movitech.mobile.ddzy.modules.jobs.SynCalibrationBidJob;
import com.movitech.mobile.ddzy.modules.jobs.SynSupplier2CostJob;
import com.movitech.mobile.task.CalibrationBidSynRabbitMQProducer;
import com.movitech.mobile.task.ContractPlanSynRabbitMQConsumer;
import com.movitech.mobile.task.OrgAndUserSynRabbitMQConsumer;
import com.movitech.mobile.task.SupplierInfoSynRabbitMQProducer;
import com.movitech.utils.LoggerManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 启动初始化类
 *
 * @author 杜军
 * @version 1.0.0
 * @description 启动初始化类
 * @createTime 2020/07/14
 * @copyright Copyright © 2020 魔马科技
 */
@Component
@Order(value = 100)
public class InitRunner implements ApplicationRunner {

    public static LoggerManager log = LoggerManager.get(InitRunner.class);
    @Autowired
    OrgAndUserSynRabbitMQConsumer orgAndUserSynRabbitMQConsumer;
    @Autowired
    ContractPlanSynRabbitMQConsumer contractPlanSynRabbitMQConsumer;
    @Autowired
    CalibrationBidSynRabbitMQProducer calibrationBidSynRabbtMQProducer;
    @Autowired
    SupplierInfoSynRabbitMQProducer supplierInfoSynRabbitMQProducer;
    @Autowired
    SynCalibrationBidJob synCalibrationBidJob;
    @Autowired
    SynSupplier2CostJob synSupplier2CostJob;

    @Override
    public void run(ApplicationArguments var1) {
        orgAndUserSynRabbitMQConsumer.init();
        contractPlanSynRabbitMQConsumer.init();
        calibrationBidSynRabbtMQProducer.init();
        supplierInfoSynRabbitMQProducer.init();
        log.info("=============》初始化MQ消费队列完成《============");

        synCalibrationBidJob.synAwardBid2Cost();
        log.info("=============》定标数据同步成本系统完成 《============");
        synSupplier2CostJob.syncSupplier2Cost();
        log.info("=============》供应商数据同步至成本系统完成 《============");
        log.info("=============》应用启动完成《============");
    }


}
